// 用户类接口
// 引入
import axios from "@/utils/request.js";
// 封装登录接口
export const login = data => {
  return axios({
    method: "POST",
    url: "/app/v1_0/authorizations",
    data
  });
};

// 封装获取验证码接口
export const getCode = mobile => {
  return axios({
    url: `/app/v1_0/sms/codes/${mobile}`,
    method: "GET"
  });
};

// 获取用户的个人信息 我的页面
export const getUserInfo = () => {
  return axios({
    method: "GET",
    url: "/app/v1_0/user"
  });
};

// 获取用户的基本资料  编辑个人信息页面
export const getBaseInfo = () => {
  return axios({
    method: "GET",
    url: "/app/v1_0/user/profile"
  });
};

// 修改用户的个人基本资料
export const editBaseInfo = obj => {
  return axios({
    method: "PATCH",
    url: "/app/v1_0/user/profile",
    data: obj
  });
};

// 修改用户头像接口
export const editAvatar = formdata => {
  return axios({
    method: "PATCH",
    url: "/app/v1_0/user/photo",
    data: formdata
  });
};
